//
//  GWMyNavigationController.m
//  新浪微博
//
//  Created by qianfeng on 16/1/9.
//  Copyright (c) 2016年 高炜. All rights reserved.
//

#import "GWMyNavigationController.h"
#import "GWMyBarButtonItem.h"
@implementation GWMyNavigationController

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    
    if (self.viewControllers.count>0) {
        viewController.hidesBottomBarWhenPushed =YES;
        viewController.navigationItem.leftBarButtonItem =[GWMyBarButtonItem barButtonItemWithImageName:@"navigationbar_back" highLightName:@"navigationbar_back_highlighted" target:self action:@selector(back)];
        viewController.navigationItem.rightBarButtonItem =[GWMyBarButtonItem barButtonItemWithImageName:@"navigationbar_more" highLightName:@"navigationbar_more_highlighted"target:self action:@selector(home)];
    }
    [super pushViewController:viewController animated:animated];
    
}
-(void)back
{
    [self popViewControllerAnimated:YES];
}
-(void)home
{
    [self popToRootViewControllerAnimated:YES];
}



+(void)initialize
{
    UINavigationBar *appNavBar =[UINavigationBar appearance];
    [appNavBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:17]}];
    
    
    UIBarButtonItem *appearance =[UIBarButtonItem appearance];
    NSDictionary *disabledattributes =@{NSForegroundColorAttributeName:[UIColor grayColor]};
    [appearance setTitleTextAttributes:disabledattributes forState:UIControlStateDisabled];
    
    NSDictionary *normalattributes =@{NSFontAttributeName:[UIFont systemFontOfSize:15],NSForegroundColorAttributeName:[UIColor orangeColor]};
    [appearance setTitleTextAttributes:normalattributes forState:UIControlStateNormal];
    
    NSDictionary *highlightedattributes =@{NSForegroundColorAttributeName:[UIColor grayColor]};
    [appearance setTitleTextAttributes:highlightedattributes forState:UIControlStateHighlighted];
}


@end
